<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./vue.global.js"></script>
    <style>
        .box{
            background-color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <!--1：如果定义了class作为父子通信的传递（用props接收了），则样式不会显示,
                未接受，则样式显示，传递给了容器-->
        <my-head title="hello world" class="box"></my-head>
    </div>
    <script>
        let app = Vue.createApp({
            data(){
                return {
                    count: 10
                }
            },
            mounted(){
                setTimeout(()=>{
                    this.count = 20
                },2000)
            },
        })

        app.component(
            'MyHead',
            {
                <!--2：如果定义了class作为父子通信的传递，则样式不会显示-->
                props:['title',],
                //props:['title','class'],
                template: `
                <header>
                  <!---->
                  <div>父组件传递过来的：{{title}} </div>
                    <h2>logo</h2>
                    <ul>
                        <li>首页</li>
                        <li>视频</li>
                        <li>音乐</li>
                    </ul>
                </header>
                `,
                //3：未传递props，则要显示组件样式，用inheritAttrs可以阻止这种行为
                inheritAttrs:false
            })

        let vm = app.mount('#app');
    </script>

</body>
</html>